﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace NBA.UI.usercontrol
{
    public partial class LineChart : System.Web.UI.UserControl
    {
        public string Title { get; set; }
        public string SubTitle { get; set; }
        public List<string> xAxis { get; set; }
        public Axis yAxis { get; set; }
        public List<Series> SeriesSet { get; set; }
        protected string DataString { get; set; }
        protected string divId = string.Empty;

        protected void Page_Load(object sender, EventArgs e)
        {
            divId = container.ClientID;

            List<string> strSeriesSet = new List<string>();
            if (SeriesSet != null && SeriesSet.Count > 0)
            {
                foreach (Series series in SeriesSet)
                {
                    string str = string.Format(@"{{name:'{0}',data:[{1}]}}", series.Name, string.Join(",", series.Data));
                    strSeriesSet.Add(str);
                }
            }
            DataString = string.Join(",", strSeriesSet);
        }
    }
}



public class Series
{
    public string Name { get; set; }
    public List<double> Data { get; set; }
}

public class Axis
{
    public string Title { get; set; }
    public PlotLines Line { get; set; }
}

public class PlotLines
{
    public int Value { get; set; }
    public int Width { get; set; }
    public string Color { get; set; }
}
